/*******************************************************************************
 * Copyright (c) 2008, 2009 Tapestry IDE Developers
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Tapestry IDE Developers - initial API and implementation
 *******************************************************************************/
package com.googlecode.tapestry.ide.ui.viewers;

import org.eclipse.swt.graphics.Image;

import com.googlecode.tapestry.ide.TapestryPlugin;
import com.googlecode.tapestry.ide.core.model.ITapestryContainer;
import com.googlecode.tapestry.ide.core.model.ITapestryItem;
import com.googlecode.tapestry.ide.core.model.ITapestryProject;
import com.googlecode.tapestry.ide.ui.TapestryImages;

/**
 * This {@link DecoratingWorkbenchTreePathLabelProvider} knows about Tapestry
 * projects.
 */
public class TapestryUILabelProvider extends
		DecoratingWorkbenchTreePathLabelProvider {

	/**
	 * Instantiates a new tapestry ui label provider.
	 * 
	 * @param isDecorating
	 *            the is decorating
	 */
	public TapestryUILabelProvider(boolean isDecorating) {
		super(isDecorating);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.googlecode.tapestry.ide.ui.viewers.
	 * DecoratingWorkbenchTreePathLabelProvider #getImage(java.lang.Object,
	 * java.lang.Object)
	 */
	@Override
	protected Image getImage(Object element, Object parentElement) {
		if (element instanceof ITapestryProject) {
			Image image = TapestryPlugin.getDefault().getImageRegistry().get(
					TapestryImages.IMG_OBJS_PROJECT);
			return image;
		}
		if (element instanceof ITapestryContainer<?>) {
			Image image = TapestryPlugin.getDefault().getImageRegistry().get(
					TapestryImages.IMG_OBJS_CONTAINER);
			return image;
		}
		if (element instanceof ITapestryItem) {
			Image image = TapestryPlugin.getDefault().getImageRegistry().get(
					TapestryImages.IMG_OBJS_ITEM);
			return image;
		}
		return super.getImage(element, parentElement);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.googlecode.tapestry.ide.ui.viewers.
	 * DecoratingWorkbenchTreePathLabelProvider #getText(java.lang.Object,
	 * java.lang.Object)
	 */
	@Override
	protected String getText(Object element, Object parentElement) {
		return super.getText(element, parentElement);
	}
}
